package com.slz3.business.module.goodsManagement.gooBrand.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class GooBrandFactory {

    /**
     * 初始化基础属性值
     */
    public static GooBrand initBaseFields(GooBrand gooBrand) {
        if (gooBrand.getUuid() == null) {
            gooBrand.setUuid(UUIDUtils.generateUUID());
            gooBrand.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(gooBrand.getSerAudit())) {
                gooBrand.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(gooBrand.getSerUsing())) {
                gooBrand.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            gooBrand.setLastModifyTime(LocalDateTime.now());
        }
        return gooBrand;
    }

    /**
     * 初始化基础属性值
     */
    public static GooBrand initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static GooBrand newTemStyle() {
        return new GooBrand();
    }

}
